package Solutions


func numberOfSubarrays(nums []int, k int) int {
    var mp=make(map[int]int,len(nums))
    var nCount=0
    for _,v:=range nums{
        if v&1==1{
            nCount++
        }
        mp[nCount]++
    }
    mp[0]++
    var ans=0
    for key,v:=range mp{
        if v1,ok:=mp[key-k];ok{
            ans+=v*v1
        }
    }
    return ans
}